<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">

<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>gamvas</title><link rel="stylesheet" type="text/css" href="../styles/main.css"><script language=JavaScript src="../javascript/main.js"></script><script language=JavaScript src="../javascript/prettify.js"></script><script language=JavaScript src="../javascript/searchdata.js"></script></head><body class="ContentPage" onLoad="NDOnLoad();prettyPrint();"><script language=JavaScript><!--
if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>

<!--  Generated by Natural Docs, version 1.51 -->
<!--  http://www.naturaldocs.org  -->

<!-- saved from url=(0026)http://www.naturaldocs.org -->




<div id=Content><div class="CClass"><div class=CTopic id=MainTopic><h1 class=CTitle><a name="gamvas"></a>gamvas</h1><div class=CBody><h4 class=CHeading>Description</h4><p>Basic functions for handling the gamvas environment: <a href="http://gamvas.com" class=LURL target=_top>http://gamvas.com</a></p><p>Gamvas is a HTML5 game development framework/engine that simplifies the task of developing games.&nbsp; It keeps the developer away from the boring tasks and allows you to concentrate on the gameplay instead of spending weeks coding just to get you a useful base framework for your game.</p><p>The framework uses upper case words for classes, lowercase words for static functions.&nbsp; For example, see <a href="gamvas-state-state-js.html#gamvas.State" class=LClass id=link8 onMouseOver="ShowTip(event, 'tt8', 'link8')" onMouseOut="HideTip('tt8')">gamvas.State</a> vs <a href="gamvas-state-js.html#gamvas.state" class=LClass id=link9 onMouseOver="ShowTip(event, 'tt9', 'link9')" onMouseOut="HideTip('tt9')">gamvas.state</a></p><p>While the use of static functions won&rsquo;t win Gamvas a award in object oriented software design, it will in certain situations improve performance and reduce necessary amount of source code and therfor further speed up your development process.</p><p>At the moment Gamvas is more like a framework for developing games with the HTML5 canvas element and you&rsquo;ll need quite a bit of JavaScript knowledge to use it, although i hope that the documentation and examples make it even possible for JavaScript beginners to get their dream game to life.</p><p>Gamvas is planned to evolve into a full game engine though with native graphical editors on Linux, Mac OSX and Windows.&nbsp; I want to make this system as useful as it can get for the developers, so future features depend on the requirements.&nbsp; Feel free to contact me with feature requests at <a href="#" onClick="location.href='mai' + 'lto:' + 'h' + 'i' + '@' + '93-intera' + 'ctive.com'; return false;" class=LEMail>h<span style="display: none">.nosp@m.</span>i<span>@</span>93-intera<span style="display: none">.nosp@m.</span>ctive.com</a></p><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SMain"><td class=SEntry><a href="#gamvas" >gamvas</a></td><td class=SDescription>Basic functions for handling the gamvas environment: <a href="http://gamvas.com" class=LURL target=_top>http://gamvas.com</a></td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#gamvas.Variables" >Variables</a></td><td class=SDescription></td></tr><tr class="SVariable SIndent2 SMarked"><td class=SEntry><a href="#gamvas.baseURL" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')">baseURL</a></td><td class=SDescription>The place there the gamvas scripts live Will be filled on startup</td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#gamvas.Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#gamvas.start" id=link2 onMouseOver="ShowTip(event, 'tt2', 'link2')" onMouseOut="HideTip('tt2')">start</a></td><td class=SDescription>Starts the gamvas system</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#gamvas.getCanvasPosition" id=link3 onMouseOver="ShowTip(event, 'tt3', 'link3')" onMouseOut="HideTip('tt3')">getCanvasPosition</a></td><td class=SDescription>Get the position in DOM of the current canvas</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#gamvas.getCanvasDimension" id=link4 onMouseOver="ShowTip(event, 'tt4', 'link4')" onMouseOut="HideTip('tt4')">getCanvasDimension</a></td><td class=SDescription>Get the width and height of the canvas</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#gamvas.getCanvas" id=link5 onMouseOver="ShowTip(event, 'tt5', 'link5')" onMouseOut="HideTip('tt5')">getCanvas</a></td><td class=SDescription>Get the canvas element</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#gamvas.getContext2D" id=link6 onMouseOver="ShowTip(event, 'tt6', 'link6')" onMouseOut="HideTip('tt6')">getContext2D</a></td><td class=SDescription>Get the 2D context object of the canvas</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#gamvas.isSet" id=link7 onMouseOver="ShowTip(event, 'tt7', 'link7')" onMouseOut="HideTip('tt7')">isSet</a></td><td class=SDescription>Tests if a variable is set</td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>

<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="gamvas.Variables"></a>Variables</h3></div></div>

<div class="CVariable"><div class=CTopic><h3 class=CTitle><a name="gamvas.baseURL"></a>baseURL</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">baseURL: ''</td></tr></table></blockquote><p>The place there the gamvas scripts live Will be filled on startup</p></div></div></div>

<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="gamvas.Functions"></a>Functions</h3></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gamvas.start"></a>start</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>start: function(</td><td class="PParameter  prettyprint " nowrap>canvasid,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>usePhysics,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>doSleep</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><h4 class=CHeading>Description</h4><p>Starts the gamvas system</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>canvasID</td><td class=CDLDescription>The id of the canvas element to start gamvas on</td></tr><tr><td class=CDLEntry>usePhysics</td><td class=CDLDescription>Use physics (requires box2dweb JavaScript)</td></tr><tr><td class=CDLEntry>doSleep</td><td class=CDLDescription>If using physics, allow objects to &lsquo;fall asleep&rsquo; when not active anymore</td></tr></table><h4 class=CHeading>Example</h4><p>A typical gamvas start, add a onload handler that adds your main game state and starts gamvas on the canvas with id &ldquo;myCanvas&rdquo; and enables physics support</p><blockquote><pre>gamvas.event.addOnLoad(function() {
   gamvas.state.addState(myState);
   gamvas.start('myCanvas', true);
});</pre></blockquote></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gamvas.getCanvasPosition"></a>getCanvasPosition</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">getCanvasPosition: function()</td></tr></table></blockquote><h4 class=CHeading>Description</h4><p>Get the position in DOM of the current canvas</p><h4 class=CHeading>Returns</h4><p><a href="gamvas-vector2d-js.html#gamvas.Vector2D" class=LClass id=link10 onMouseOver="ShowTip(event, 'tt10', 'link10')" onMouseOut="HideTip('tt10')">gamvas.Vector2D</a></p><h4 class=CHeading>See</h4><p><a href="gamvas-dom-js.html#gamvas.dom.getPosition" class=LFunction id=link11 onMouseOver="ShowTip(event, 'tt11', 'link11')" onMouseOut="HideTip('tt11')">gamvas.dom.getPosition</a></p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gamvas.getCanvasDimension"></a>getCanvasDimension</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">getCanvasDimension: function()</td></tr></table></blockquote><h4 class=CHeading>Description</h4><p>Get the width and height of the canvas</p><h4 class=CHeading>Returns</h4><p>Object {w, h} with with and height of the canvas</p><h4 class=CHeading>Example</h4><blockquote><pre>var d = gamvas.getCanvasDimension();
alert('canvas has a width of '+d.w+' pixels');</pre></blockquote></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gamvas.getCanvas"></a>getCanvas</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">getCanvas: function()</td></tr></table></blockquote><h4 class=CHeading>Description</h4><p>Get the canvas element</p><h4 class=CHeading>Returns</h4><p>Canvas DOM element</p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gamvas.getContext2D"></a>getContext2D</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">getContext2D: function()</td></tr></table></blockquote><h4 class=CHeading>Description</h4><p>Get the 2D context object of the canvas</p><h4 class=CHeading>Returns</h4><p>The 2D context of the canvas</p><h4 class=CHeading>See</h4><p><a href="http://dev.w3.org/html5/2dcontext/" class=LURL target=_top>http://dev.w3.org/html5/2dcontext/</a></p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="gamvas.isSet"></a>isSet</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>isSet: function(</td><td class="PParameter  prettyprint " nowrap>v</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><h4 class=CHeading>Description</h4><p>Tests if a variable is set</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>v</td><td class=CDLDescription>the variable</td></tr></table><h4 class=CHeading>Returns</h4><p>true or false</p><h4 class=CHeading>Example</h4><blockquote><pre>var el = document.getElementById('myelement');
if (!gamvas.isSet(el)) {
    alert('myelement not found');
}</pre></blockquote></div></div></div>

</div><!--Content-->


<div id=Footer><a href="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->


<div id=Menu><div class=MEntry><div class=MFile id=MSelected>gamvas</div></div><div class=MEntry><div class=MFile><a href="gamvas-actor-js.html">gamvas.<wbr>Actor</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-actorstate-js.html">gamvas.<wbr>ActorState</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-animation-js.html">gamvas.<wbr>Animation</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-camera-js.html">gamvas.<wbr>Camera</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-class-js.html">gamvas.<wbr>Class</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-dom-js.html">gamvas.dom</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-event-js.html">gamvas.<wbr>event</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-image-js.html">gamvas.<wbr>Image</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-key-js.html">gamvas.key</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-mouse-js.html">gamvas.<wbr>mouse</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-particleemitter-js.html">gamvas.<wbr>ParticleEmitter</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-physics-js.html">gamvas.<wbr>physics</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-physics-userdata-js.html">gamvas.<wbr>physics.<wbr>UserData</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-rect-js.html">gamvas.Rect</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-resource-js.html">gamvas.<wbr>Resource</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-screen-js.html">gamvas.<wbr>screen</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-sound-js.html">gamvas.<wbr>Sound</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-state-js.html">gamvas.<wbr>state</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-state-state-js.html">gamvas.<wbr>State</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-timer-js.html">gamvas.<wbr>timer</a></div></div><div class=MEntry><div class=MFile><a href="gamvas-vector2d-js.html">gamvas.<wbr>Vector2D</a></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent1')">Index</a><div class=MGroupContent id=MGroupContent1><div class=MEntry><div class=MIndex><a href="../index/General.html">Everything</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Classes.html">Classes</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Functions.html">Functions</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Macros.html">Macros</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Variables.html">Variables</a></div></div></div></div></div><script type="text/javascript"><!--
var searchPanel = new SearchPanel("searchPanel", "HTML", "../search");
--></script><div id=MSearchPanel class=MSearchPanelInactive><input type=text id=MSearchField value=Search onFocus="searchPanel.OnSearchFieldFocus(true)" onBlur="searchPanel.OnSearchFieldFocus(false)" onKeyUp="searchPanel.OnSearchFieldChange()"><select id=MSearchType onFocus="searchPanel.OnSearchTypeFocus(true)" onBlur="searchPanel.OnSearchTypeFocus(false)" onChange="searchPanel.OnSearchTypeChange()"><option  id=MSearchEverything selected value="General">Everything</option><option value="Classes">Classes</option><option value="Functions">Functions</option><option value="Macros">Macros</option><option value="Variables">Variables</option></select></div></div><!--Menu-->



<!--START_ND_TOOLTIPS-->
<div class=CToolTip id="tt1"><div class=CVariable><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">baseURL: ''</td></tr></table></blockquote>The place there the gamvas scripts live Will be filled on startup</div></div><div class=CToolTip id="tt2"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>start: function(</td><td class="PParameter  prettyprint " nowrap>canvasid,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>usePhysics,</td></tr><tr><td></td><td class="PParameter  prettyprint " nowrap>doSleep</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Starts the gamvas system</div></div><div class=CToolTip id="tt3"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">getCanvasPosition: function()</td></tr></table></blockquote>Get the position in DOM of the current canvas</div></div><div class=CToolTip id="tt4"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">getCanvasDimension: function()</td></tr></table></blockquote>Get the width and height of the canvas</div></div><div class=CToolTip id="tt5"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">getCanvas: function()</td></tr></table></blockquote>Get the canvas element</div></div><div class=CToolTip id="tt6"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">getContext2D: function()</td></tr></table></blockquote>Get the 2D context object of the canvas</div></div><div class=CToolTip id="tt7"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>isSet: function(</td><td class="PParameter  prettyprint " nowrap>v</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Tests if a variable is set</div></div><div class=CToolTip id="tt8"><div class=CClass>Game state class, overwrite for own states</div></div><div class=CToolTip id="tt9"><div class=CClass>Helper functions for state management</div></div><div class=CToolTip id="tt10"><div class=CClass>A 2D vector class</div></div><div class=CToolTip id="tt11"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters  prettyprint "nowrap>getPosition: function(</td><td class="PParameter  prettyprint " nowrap>el</td><td class="PAfterParameters  prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Gets the position of a DOM element</div></div><!--END_ND_TOOLTIPS-->




<div id=MSearchResultsWindow><iframe src="" frameborder=0 name=MSearchResults id=MSearchResults></iframe><a href="javascript:searchPanel.CloseResultsWindow()" id=MSearchResultsWindowClose>Close</a></div>


<script language=JavaScript><!--
if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html>